<?php
function table_list()
{
    return array(
        'action' => array('name' => 'action'),
        'action_limit' => array('name' => 'action_limit'),
        'action_log' => array('name' => 'action_log'),
        'addons' => array('name' => 'addons'),
        'attachment' => array('name' => 'attachment'),
        'auth_extend' => array('name' => 'auth_extend'),
        'auth_group' => array('name' => 'auth_group'),
        'auth_group_access' => array('name' => 'auth_group_access'),
        'auth_rule' => array('name' => 'auth_rule'),
        'avatar' => array('name' => 'avatar'),
        'channel' => array('name' => 'channel'),
        'config' => array('name' => 'config'),
        'field' => array('name' => 'field'),
        'field_group' => array('name' => 'field_group'),
        'field_setting' => array('name' => 'field_setting'),
        'file' => array('name' => 'file'),
        'follow' => array('name' => 'follow'),
        'hook' => array('name' => 'hook'),
        'invite' => array('name' => 'invite'),
        'invite_buy_log' => array('name' => 'invite_buy_log'),
        'invite_log' => array('name' => 'invite_log'),
        'invite_type' => array('name' => 'invite_type'),
        'invite_user_info' => array('name' => 'invite_user_info'),
        'member' => array('name' => 'member'),
        'menu' => array('name' => 'menu'),
        'message' => array('name' => 'message'),
        'message_content' => array('name' => 'message_content'),
        'module' => array('name' => 'module'),
        'picture' => array('name' => 'picture'),
        'rank' => array('name' => 'rank'),
        'rank_user' => array('name' => 'rank_user'),
        'role' => array('name' => 'role'),
        'role_config' => array('name' => 'role_config'),
        'role_group' => array('name' => 'role_group'),
        'score_log' => array('name' => 'score_log'),
        'seo_rule' => array('name' => 'seo_rule'),
        'sso_app' => array('name' => 'sso_app'),
        'talk' => array('name' => 'talk'),
        'talk_message' => array('name' => 'talk_message'),
        'talk_message_push' => array('name' => 'talk_message_push'),
        'talk_push' => array('name' => 'talk_push'),
        'ucenter_admin' => array('name' => 'ucenter_admin'),
        'ucenter_member' => array('name' => 'ucenter_member'),
        'ucenter_score_type' => array('name' => 'ucenter_score_type'),
        'ucenter_setting' => array('name' => 'ucenter_setting'),
        'url' => array('name' => 'url'),
        'user_config' => array('name' => 'user_config'),
        'user_role' => array('name' => 'user_role'),
        'user_tag' => array('name' => 'user_tag'),
        'user_tag_link' => array('name' => 'user_tag_link'),
        'user_token' => array('name' => 'user_token'),
        'verify' => array('name' => 'verify'),
        'version' => array('name' => 'version'),
    );
}



function application_table(){
    return array(
        array('name' => 0 ,'info'=>'以下是微博模块','next'=>'weibo'),
        'weibo' => array('name' => 'weibo'),
        'weibo_comment' => array('name' => 'weibo_comment'),
        'topic' => array('name' => 'topic','new_name'=>'weibo_topic'),
        array('name' => 0 ,'info'=>'以下是群组模块','next'=>'group'),
        'group' => array('name' => 'group'),
        'group_bookmark' => array('name' => 'group_bookmark'),
        'group_dynamic' => array('name' => 'group_dynamic'),
        'group_lzl_reply' => array('name' => 'group_lzl_reply'),
        'group_member' => array('name' => 'group_member'),
        'group_notice' => array('name' => 'group_notice'),
        'group_post' => array('name' => 'group_post'),
        'group_post_category' => array('name' => 'group_post_category'),
        'group_post_reply' => array('name' => 'group_post_reply'),
        'group_type' => array('name' => 'group_type'),
        array('name' => 0 ,'info'=>'以下是论坛模块','next'=>'forum'),
        'forum' => array('name' => 'forum'),
        'forum_follow' => array('name' => 'forum_follow'),
        'forum_bookmark' => array('name' => 'forum_bookmark'),
        'forum_lzl_reply' => array('name' => 'forum_lzl_reply'),
        'forum_post' => array('name' => 'forum_post'),
        'forum_post_reply' => array('name' => 'forum_post_reply'),
        'forum_type' => array('name' => 'forum_type'),
        array('name' => 0 ,'info'=>'以下是活动模块','next'=>'event'),
        'event' => array('name' => 'event'),
        'event_attend' => array('name' => 'event_attend'),
        'event_type' => array('name' => 'event_type'),

        array('name' => 0 ,'info'=>'以下是专辑模块','next'=>'issue'),
        'issue' => array('name' => 'issue'),
        'issue_content' => array('name' => 'issue_content'),


        array('name' => 0 ,'info'=>'以下是分类信息模块','next'=>'cat_data'),
        'cat_data' => array('name' => 'cat_data'),
        'cat_entity' => array('name' => 'cat_entity'),
        'cat_fav' => array('name' => 'cat_fav'),
        'cat_field' => array('name' => 'cat_field'),
        'cat_info' => array('name' => 'cat_info'),
        'cat_rate' => array('name' => 'cat_rate'),
        'cat_read' => array('name' => 'cat_read'),
        'cat_send' => array('name' => 'cat_send'),

        array('name' => 0 ,'info'=>'以下是积分商城模块','next'=>'shop'),
        'shop' => array('name' => 'shop'),
        'shop_address' => array('name' => 'shop_address'),
        'shop_buy' => array('name' => 'shop_buy'),
        'shop_category' => array('name' => 'shop_category'),
        'shop_log' => array('name' => 'shop_log'),
        'shop_see' => array('name' => 'shop_see'),

        array('name' => 0 ,'info'=>'以下是微店模块','next'=>'store_adv'),
        'store_adv' => array('name' => 'store_adv'),
        'store_category' => array('name' => 'store_category'),
        'store_com' => array('name' => 'store_com'),
        'store_data' => array('name' => 'store_data'),
        'store_entity' => array('name' => 'store_entity'),
        'store_fav' => array('name' => 'store_fav'),
        'store_field' => array('name' => 'store_field'),
        'store_goods' => array('name' => 'store_goods'),
        'store_item' => array('name' => 'store_item'),
        'store_order' => array('name' => 'store_order'),
        'store_rate' => array('name' => 'store_rate'),
        'store_read' => array('name' => 'store_read'),
        'store_send' => array('name' => 'store_send'),
        'store_shop' => array('name' => 'store_shop'),

        array('name' => 0 ,'info'=>'以下是资讯模块','next'=>'document'),
        'document' => array('name' => 'document','new_name'=>'news'),
        'news_category' => array('name' => 'news_category'),


    );
}

/**
 * use_V2  用于模块转移时标志使用V2的数据表
 * @return array
 * @author:xjw129xjt(肖骏涛) xjt@ourstu.com
 */
function use_V2(){
    return array(
        'forum_follow',
        'news_category',
    );
}

function use_V1()
{
    return array(
        'attachment',
        'auth_extend',
        'auth_group',
        'auth_group_access',
        'avatar',
        //'config',
        'field',
        'field_group',
        'file',
        'follow',
        'member',
        'picture',
        'rank',
        'rank_user',
        'seo_rule',
        'ucenter_member',
        'ucenter_setting',
        'url',
        'user_token',
        // 插件部分
        'local_comment',
        'support',
        'super_links',
        'sync_login',
        'advertising',
        'advs',
    );
}



function addons_table(){
    return array(
        'checkin' => array('name' => 'checkin'),
        'district' => array('name' => 'district'),
        'local_comment' => array('name' => 'local_comment'),
        'report' => array('name' => 'report'),
        'super_links' => array('name' => 'super_links'),
        'support' => array('name' => 'support'),
        'sync_login' => array('name' => 'sync_login'),

        'advertising' => array('name' => 'advertising'),
        'advs' => array('name' => 'advs'),
    );
}

function get_next($array, $current)
{
    foreach ($array as $key => $val) {
        if ($key === $current) {
            break;
        }
        next($array);
    }
    return next($array);
}


function truncate_table($table)
{
    M()->execute('TRUNCATE TABLE ' . C("DB_PREFIX") . $table);
}

function drop_table($table)
{
    M()->execute('DROP TABLE ' . C("DB_PREFIX") . $table);
}
